# Maintainer: Jelle van der Waa <jelle@archlinux.org>

pkgname=python-meilisearch
pkgver=0.26.0
pkgrel=1
pkgdesc='Python client for MeiliSearch API'
arch=(any)
license=('MIT')
url='https://pypi.org/project/meilisearch/'
depends=(python python-requests python-camel-converter python-pydantic)
makedepends=(python-setuptools python-build python-installer python-wheel)
checkdepends=(python-pytest python-pytest-ordering)
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/meilisearch/meilisearch-python/archive/v${pkgver}.tar.gz)
sha512sums=('f03102bec75f3132d49b3e550fdc978da2cd09d9667280afd1797e72ef429279970cd09f31399e9e0c27dddce18d0a9aad2d2eba24867a7b9fe49831e9f07ade')

build() {
  cd "meilisearch-python-${pkgver}"
  python -m build --wheel --no-isolation
}

check() {
  # requires running meilisearch https://github.com/meilisearch/meilisearch-python/blob/master/.github/workflows/test.yml#L20
  cd "meilisearch-python-${pkgver}"
  #pytest .
}

package() {
  cd "meilisearch-python-${pkgver}"

  python -m installer --destdir="$pkgdir" dist/*.whl

  install -D -m644 LICENSE "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
}
